home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 September / SGI IRIX Patches 1995 Sep.iso / 5.3_patches / patchSG0000466 / patchSG0000466.idb / etc / init.d / disk_patch.z / disk_patch
Text File  |  1995-09-07  |  1KB  |  52 lines

  1. #! /sbin/sh
  2. #Tag 0x00000f00
  3.  
  4. is_deskside ()
  5. {
  6.     maxslot=0
  7.     hinv -c iobd | grep Ebus | sed "s/://g" | ( \
  8.     while read io brd ebus slot slotnum io4 rev revnum; do
  9.         if [ $slotnum -gt $maxslot ]; then
  10.             maxslot=$slotnum;
  11.         fi;
  12.     done;
  13.     if [ $maxslot -gt 0 -a $maxslot -lt 11 ]; then
  14.         echo 1
  15.     else
  16.         echo 0
  17.     fi)
  18. }
  19.  
  20. case $1 in
  21. 'start')
  22.     # check to see if any drives need firmware downloaded, on powerup
  23.     # This is to handle any drives moved from another system, etc.,
  24.     # This just warns if any drives should be upgraded.
  25.     /sbin/diskpatch -W
  26.     ;;
  27. 'stop')
  28.     # if we are rebooting, then don't spin down any of the drives.
  29.     # otherwise spin down all of the drives that benefit from this
  30.     set `who -r`
  31.     if [ $7 != "6" ]
  32.     then
  33.         if hinv -c iobd | grep IO4 > /dev/null
  34.         then # [Power] Challenge/Onyx DM/L/XL  (EVEREST Machines)
  35.             if [ `is_deskside` -eq 1 ]; then
  36.                 spinagain=-S11
  37.             else
  38.                 spinagain=-S5
  39.             fi
  40.         elif [ "`hinv -c disk | egrep 'Disk.*controller *[1-4]' | wc -l`" -gt 3 ]
  41.         then
  42.             # challenge S, jag or indigo2/challenge M w/external drives
  43.             spinagain=-S4
  44.         fi
  45.         /sbin/diskpatch -H 20 $spinagain
  46.     fi
  47.     ;;
  48. *)
  49.     echo "usage: $0 {start|stop}"
  50.     ;;
  51. esac
  52.